Skip to content

Submit model action fields locally#18

Merged
dzarlax merged 1 commit into
mainfrom
codex/model-actions-local-include
Jun 16, 2026
Merged

Submit model action fields locally#18
dzarlax merged 1 commit into
mainfrom
codex/model-actions-local-include

Conversation

@dzarlax

@dzarlax dzarlax commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • keep model action request fields inside the local action block
  • use only closest .model-actions for htmx includes to avoid mixed selector handling dropping model_id
  • assert model_id/provider hidden fields are rendered with action controls

Tests

  • go test -count=1 ./...

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved filter and search context preservation when performing actions on models in the admin interface.
    • Enhanced form submission scope for model management controls to ensure accurate state handling.

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The model_actions template now embeds filter state (view, preset, search, feature toggles, sort) as hidden inputs directly inside the .model-actions container. All HTMX action buttons (free-check, eval, paid-eval, Allow/Deny, override) switch their hx-include from a global #models-filters selector to closest .model-actions. The test is updated to match.

Changes

HTMX Include Scope and Filter State Propagation

Layer / File(s) Summary
Template: hidden filter inputs and hx-include narrowing
internal/adminapi/templates/partials_models_row.html
Adds hidden inputs for view, preset, search query, and feature/sort toggles inside model_actions. Changes hx-include on the free-check, eval, paid-eval, Allow, Deny, and manual override buttons from #models-filters (global) to closest .model-actions. Inlines hx-vals on Allow/Deny buttons.
Test: updated selector and hidden input assertions
internal/adminapi/adminapi_test.go
Updates TestModelsBrowserRendersFreeCheckAction to assert hx-include="closest .model-actions" and to verify new hidden model_id and provider inputs in the rendered free-model action.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Dzarlax-AI/personal_assistant#6: Touches the same model_actions template block and adminapi_test.go assertions around hx-include scope and hidden model_id/provider inputs for free-check and override actions.

Poem

🐇 Hop, hop, the filter finds its home,
No longer forced through selectors to roam.
The closest container holds secrets tight —
model_id, provider, hidden from sight.
Each button now whispers to neighbors near,
A tidy little scope, perfectly clear! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Submit model action fields locally' directly aligns with the PR's main objective: ensuring model action request fields remain contained within the local action block and are submitted locally rather than being scattered in the DOM.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/model-actions-local-include

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dzarlax dzarlax merged commit 409ac62 into main Jun 16, 2026
5 of 6 checks passed
@dzarlax dzarlax deleted the codex/model-actions-local-include branch June 16, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant